package com.yejiarong.common.validate.annotation;

import com.yejiarong.common.validate.TimeTemplateValidate;
import jakarta.validation.Constraint;
import jakarta.validation.Payload;

import java.lang.annotation.*;

/**
 * @author YeJR
 */
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = TimeTemplateValidate.class)
@Target({ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, ElementType.PARAMETER, ElementType.TYPE_USE})
public @interface TimeTemplate {

    String format();

    String message() default "时间格式：{format}";

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};

    @Documented
    @Retention(RetentionPolicy.RUNTIME)
    @Target({ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, ElementType.PARAMETER, ElementType.TYPE_USE})
    @interface List {
        TimeTemplate[] value();
    }

}
